import request from './request'
import {GetSmsSendLogListParam} from '../views/note/notelog/types'

// 获取短信模版列表
interface getListParam {
    keyword: string,
    type: '1' | '2' | '3',
    limit: number,
    page: number
}
export function getSmsTemplateList(data: getListParam) {
    return request({
        url: '/system/sms/template/getList',
        method: 'post',
        data
    })
}

// 获取短信模版详情
export function getSmsTemplateDetail(id: string | number) {
    return request({
        url: `/system/sms/template/getDetail/${id}`,
        method: 'get',
    })
}

// 启用或禁用短信模版
export function updateSmsTemplateState(param: {ids: Array<string | number>; status: boolean}) {
    return request({
        url: `/system/sms/template/disable?status=${param.status}`,
        method: 'post',
        data: param.ids
    })
}

// 同步短信模版
export function syncSmsTemplate() {
    return request({
        url: '/system/sms/template/syncSmsTemplate',
        method: 'get',
    })
}

// 获取短信发送数量列表
export function getSendSmsCountList(data: {limit: number, page: number, sendEndTime: string, sendStartTime: string}) {
    return request({
        url: '/system/sms/send/log/getSendSmsCountList',
        method: 'post',
        data
    })
}

// 获取短信发送记录列表
export function getSmsSendLogList(data: GetSmsSendLogListParam) {
    return request({
        url: '/system/sms/send/log/getList',
        method: 'post',
        data
    })
}

// 根据短信ID获取发送短信详情
export function getSendLogDetail(id: number | string) {
    return request({
        url: `/system/sms/send/log/getDetail/${id}`,
        method: 'get',
    })
}
// 根据短信模版ID获取短信接收角色类型下拉数据
export function getRoleType(id: number | string) {
    return request({
        url: `/system/select/getRoleType/${id}`,
        method: 'get',
    })
}
// 根据短信模版ID获取短信接收角色类型
export function getTemplateRoleType(id: number | string) {
    return request({
        url: `/system/sms/template/getRoleType/${id}`,
        method: 'get',
    })
}
// 保存短信接收者类型
export function saveRoleType(data,id: number | string) {
    return request({
        url: `/system/sms/template/saveRoleType/${id}`,
        method: 'post',
        data
    })
}